package com.tyc.wx.conifg;

import com.tyc.wx.model.WxProperties;
import com.tyc.wx.service.WxService;
import com.tyc.wx.service.WxServiceImpl;
import com.tyc.wx.utills.AppUtill;
import com.tyc.wx.utills.PublicUtill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: java类作用描述
 * @Author: tyc
 * @CreateDate: 2020/12/29 16:50
 */
@Configuration
@ConditionalOnMissingBean(WxService.class)
@EnableConfigurationProperties({WxProperties.class})
public class WxAutoConfigure {
    @Autowired
    private WxProperties wxProperties;

    @Bean
    public WxService wxService(){
        AppUtill appUtill = new AppUtill(wxProperties);
        PublicUtill publicUtill = new PublicUtill(wxProperties);
        WxService wxService = new WxServiceImpl(appUtill,publicUtill);
        return wxService;
    }
}
